package com.sphd.emanu.adapter;

import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sphd.emanu.R;
import com.sphd.emanu.config.Constant;
import com.sphd.emanu.pojo.order.Order;
import com.sphd.emanu.pojo.vip.MemDeposit;
import com.wzutils.BigDisMailUtils;
import com.wzutils.TimeUtils;

import java.util.List;

/**
 * @Author Hu
 * @Time 2017/6/29 --17:21.
 * @Email 87683202@qq.com
 */
    public class TopupDetailAdapter extends BaseQuickAdapter<MemDeposit, BaseViewHolder> {
    Context context;
    int flag;

    public TopupDetailAdapter(@LayoutRes int layoutResId, @Nullable List<MemDeposit> data, Context context, int flag) {
        super(layoutResId, data);
        this.context = context;
        this.flag = flag;
    }

    @Override
    protected void convert(BaseViewHolder helper, MemDeposit item) {

        helper
                .setText(R.id.item_sender_name_phone, item.getMemberName()+"\t"+item.getMemberPhone())
                .setText(R.id.item_money_pay,"充值"+ BigDisMailUtils.turnTrim(item.getCreditFact(), Constant.POINT))
                .setText(R.id.item_user_send_time,null!=item.getCreateDate()?TimeUtils.dateToString(item.getCreateDate(),TimeUtils.YEAR_MONTH_DAY_HOUR_MIN_SS):"")
                .setText(R.id.item_sender_rec_time,null!=item.getUpdateDate()? TimeUtils.dateToString(item.getUpdateDate(),TimeUtils.YEAR_MONTH_DAY_HOUR_MIN_SS):"")
                .setText(R.id.item_sender_recorded_time,null!=item.getEntryTime()? TimeUtils.dateToString(item.getEntryTime(),TimeUtils.YEAR_MONTH_DAY_HOUR_MIN_SS):"")
                .setVisible(R.id.item_layout_sender_rec_time, flag == 0||flag==3 ? false : true)

                .setVisible(R.id.layout_btn_confirm, flag == 1 ? true : false)
                .setVisible(R.id.item_layout_sender_recorded_time, flag == 2 ? true : false)
                .setVisible(R.id.item_layout_ignore_time, flag == 3 ? true : false)

                .addOnClickListener(R.id.item_btn_confirm)

                .setText(R.id.item_sender_name, item.getWaiterName());

    }
}
